<nav class="navbar navbar-default navbar-static-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#app-navbar-collapse">
                <span class="sr-only">Toggle Navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="{{ url('/') }}">
                Laravel Shop
            </a>
        </div>
        <div class="collapse navbar-collapse" id="app-navbar-collapse">
            <ul class="nav navbar-nav">
            </ul>
            <ul class="nav navbar-nav navbar-right">
                @guest
                    <li><a href="{{ route('login') }}">登录</a></li>
                    <li><a href="{{ route('register') }}">注册</a></li>
                @else
                    <li class="dropdown">
                        <a href="javascript:void(0)" class="dropdown-toggle" role="button" data-toggle="dropdown" aria-expanded="false">

                            <span class="user-avatar pull-left" style="margin-right:8px;margin-top: -5px;">
                                <img src="https://fsdhubcdn.phphub.org/uploads/images/201709/20/1/PtDKbASVcz.png?imageView2/1/w/60/h/60"
                                     class="img-responsive img-circle" width="30px" height="30px"/>
                            </span>
                            {{ \Illuminate\Support\Facades\Auth::user()->name }}<span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu" role="menu">
                            <li>
                                <a href="{{ route('user_addresses.index') }}"><span class="glyphicon glyphicon-link">收货地址</span></a>
                            </li>
                            <li>
                                <a href="{{ route('orders.index') }}"><span class="glyphicon glyphicon-record">我的订单</span></a>
                            </li>
                            <li>
                                <a href="{{ route('products.favorites') }}"><span class="glyphicon glyphicon-star" aria-hidden="true">我的收藏</span></a>
                            </li>
                            <li>
                                <a href="{{ route('cart.index') }}"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true">我的购物车</span></a>
                            </li>
                            <li>
                                <a href="{{ route('logout') }}"
                                   onclick="event.preventDefault();document.getElementById('logout-form').submit()" >
                                    <i class="glyphicon glyphicon-log-out"></i>退出登录
                                </a>
                                <form id="logout-form" action="{{ route('logout') }}" method="POST"
                                      style="display:none">
                                    {{ csrf_field() }}
                                </form>
                            </li>
                        </ul>
                    </li>
                @endguest
            </ul>
        </div>
    </div>
</nav>
